<template>
	<view style="padding: 10px 0 0 20px;" class="flex-row flex-row-wrap">
		<view class="img-dom" v-for="(item,index) in imageList" :key="index">
			<image class="img-item" :src="item.thumbnail" mode="scaleToFill" @click="imgView(item)"></image>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { queryAttachmentFile } from "@/api/preview"
	const props = defineProps({
		imageList: {
			type: Array,
			default: function () {
				return [];
			}
		}
	})
	
	function imgView(item) {
		let downloadPath = item.downloadPath
		let suffix = item.suffix
		queryAttachmentFile({ fileName: downloadPath, suffix }).then(res => {
			let urls = [res.data]
			uni.previewImage({
				urls: urls
			});
		})
	}
</script>

<style lang="scss" scoped>
	.img-dom {
		position: relative;
		margin: 0 10px 10px 0;
		width: calc(33% - 10px);

		.img-item {
			width: 100%;
			height: 200rpx;
			border-radius: 6rpx;
		}
	}

</style>